<template>
	<view class="content">
		<view class="header">
			<image @click="back" class="back" src="../../static/tian/back.png" mode=""></image>
			<view class="text">{{$t('first.title122')}}</view>
			<view style="width: 44rpx;"></view>
		</view>
		<view style="height: 104rpx;"></view>
		<view class="list2">
			<view class="item" v-for="(item,index) in list" v-if="list.length > 0">
				<view class="itemheader" style="margin-bottom: 18rpx;">
					<view class="left">{{item.value}}
						<text style="margin-left: 10rpx;" v-if="isSEel==1">{{item.currency.code}}</text>
						<text style="margin-left: 10rpx;" v-if="isSEel==2 && id==49">{{item.currency.code}}</text>
						<text style="margin-left: 10rpx;" v-if="isSEel==2 && id!=49">{{item.currency.code}}D</text>
					</view>
					<view class="right">{{item.memo}}<span v-if="item.extra_data.level > 0"> V{{item.extra_data.level}}</span></view>
				</view>
				<view class="itemheader">
					<view class="left1" style="font-weight: bold;">{{item.created_at}}</view>
					
				</view>
			</view>
			<u-loadmore
				v-if="list.length > 0"
				:status="loadmorestatus" 
				:loading-text="$t('first.title120')" 
				:loadmore-text="$t('first.title119')" 
				:nomore-text="$t('first.title121')"
				marginTop="18px"
			/>
			<view class="down_none" v-if="list.length == 0">
				<img src="../../static/img/none.png" alt="">
				<view class="">{{$t('CrossChainBridge.NoDataYet')}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {domain} from '../../config/domain.js'
	export default {
		data() {
			return {
				id:0,
				isSEel: 0,
				list:[],
				page:1,
				lastpage:1,
				loadmorestatus:'loadmore'
			}
		},
		onLoad(e) {
			this.isSEel = e.id;
			this.id = e.ids;
			this.getlist();
		},
		onReachBottom() {
			this.page ++;
			if(this.page <= this.lastpage){
				this.loadmorestatus = 'loading'
				var url = domain + 'api/account_log/clog?type='+this.isSEel + '&page='+this.page + '&id=' + this.id;
				var mytype = 'get';
				var userinfo = uni.getStorageSync('userinfo');
				uni.request({
					url,
					method: mytype,
					header: {
						'content-type': 'application/x-www-form-urlencoded' ,//自定义请求头信息
						'Lang':uni.getStorageSync('lang'),
						'AUTHORIZATION':userinfo.token,
					},
					success: res => {
						this.loadmorestatus = 'loadmore'
						this.list = [...this.list,...res.data.data.data]
					},
					fail: (err) => {
						this.loadmorestatus = 'loadmore'
						console.log(err)
					},
					complete: () => {
						this.loadmorestatus = 'loadmore'
						setTimeout(function() {
							uni.hideLoading();
						}, 1000);
					}
				});
			}else{
				this.loadmorestatus = 'nomore'
			}
		},
		methods: {
			copy(value){
				uni.setClipboardData({
					data:value,//要被复制的内容
					success:()=>{//复制成功的回调函数
						uni.showToast({//提示
							icon:'none',
							title:this.$t('first.title115')
						})
					}
				});
			},
			getlist(){
				var url = domain + 'api/account_log/clog?type='+this.isSEel + '&page='+this.page + '&id=' + this.id;
				var mytype = 'get';
				var userinfo = uni.getStorageSync('userinfo');
				uni.request({
					url,
					method: mytype,
					header: {
						'content-type': 'application/x-www-form-urlencoded' ,//自定义请求头信息
						'Lang':uni.getStorageSync('lang'),
						'AUTHORIZATION':userinfo.token,
					},
					success: res => {
						this.list = [...this.list,...res.data.data.data];
						this.lastpage = res.data.data.last_page;
						if(this.lastpage == 1){
							this.loadmorestatus = 'nomore'
						}
					},
					fail: (err) => {
						console.log(err)
					},
					complete: () => {
						setTimeout(function() {
							uni.hideLoading();
						}, 1000);
					}
				});
			},
			change(e){
				this.isSEel = e;
				this.page = 1;
				this.list = [];
				this.getlist()
			},
			back() {
				wx.navigateBack()
			}
		}
	}
</script>
<style>
	.header {
		width: 100%;
		height: 104rpx;
		padding: 20rpx;
		position: fixed;
		background-color: #ecf0f5;
		display: flex;
		top: 0;
		left: 0;
		align-items: center;
		justify-content: space-between;
		z-index: 999;
	}

	.back {
		width: 48rpx;
		height: 48rpx;
	}

	.header .text {
		font-size: 36rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 600;
		color: #222;
	}
</style>
<style>
	page {
		background-color: #ecf0f5
	}

	._bax {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		color: #ababb4;
		font-size: 30rpx;
		margin-top: 40rpx;
	}

	._baxIt {
		flex: 1;
		text-align: center;
		position: relative;
	}

	._baxItTow {
		color: #ffb105;
	}

	._baxItLi {
		position: absolute;
		width: 70rpx;
		height: 5rpx;
		top: 50rpx;
		left: 50%;
		transform: translateX(-50%);
		background-color: #ffb105;
	}

	.content {
		position: relative;
		overflow: hidden;
	}

	.topBoxL {
		width: 60%;
	}

	.topBoxLTop {
		font-size: 52rpx;
		font-weight: 600;
		color: #0c0c0c;
		margin-bottom: 30rpx;
		word-wrap: break-word;
	}

	.topBox {
		width: 100%;
		padding: 30rpx 0rpx 0rpx 30rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.topBoxLBot {
		font-size: 30rpx;
	}

	.mydao {
		width: 300rpx;
		height: 300rpx;
	}


	.listBox {
		width: 100%;
		display: flex;
		justify-content: space-around;
	}

	.list {
		width: 45%;
		height: 160rpx;
		box-shadow: 0 18rpx 45rpx 0 rgba(0, 0, 0, .08);
		border-radius: 40rpx;
		padding: 40rpx;
		box-sizing: border-box;
		position: relative;
		overflow: hidden;
	}


	.list2 {
		width: 100%;
		border-radius: 40rpx;
		padding: 50rpx;
		box-sizing: border-box;
	}

	.list view:nth-child(1) {
		font-size: 35rpx;
		font-weight: 700;
		color: #0c0c0c;
		margin-bottom: 20rpx;
	}

	.list view:nth-child(2) {
		font-size: 24rpx;
		color: #909090;
	}

	.list img {
		position: absolute;
		right: 0;
		bottom: 0;
		width: 108rpx;
		height: 86rpx;
	}

	.down_title {
		font-size: 38rpx;
		font-weight: 600;
		color: #222;
	}

	.down_none {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 560rpx;
		height: 580rpx;
		margin-top: 10rpx;
	}

	.down_none img {
		width: 402rpx;
		height: 352rpx;
	}

	.down_none view {
		font-size: 25rpx;
		color: #9394bc
	}
	
	.item{
		width: 100%;
		/* height: 146rpx; */
		background: #fff;
		box-shadow: 0 0.18667rem 0.42667rem 0 rgb(0 0 0 / 8%);
		border-radius: 32rpx;
		margin-bottom: 40rpx;
		padding: 36rpx;
		box-sizing: border-box;
	}
	.itemheader{
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.itemheader .left{
		font-size: 32rpx;
		font-weight: bold;
		color: #323233;
	}
	.itemheader .left1{
		font-size: 24rpx;
		color: #858587;
	}
	.itemheader .right{
		flex: 1;
		text-align: right;
		font-size: 24rpx;
		color: #ffb40f;
		white-space:nowrap;
		overflow:hidden;
		margin-left: 40rpx;
	}
	.itemheader .right1{
		font-size: 24rpx;
		color: #858587;
	}
	.itemheader .right2{
		font-size: 24rpx;
		color: #00aa00;
	}
</style>